#ifndef UTIL_HH_
#define UTIL_HH_

// #include <iomanip>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <cmath>
#include <vector>
#include <gsl/gsl_sf_psi.h>

std::string curr_time();

#define TLOG(msg) { std::cerr << "[" << curr_time() << "] " << msg << std::endl; }
#define ELOG(msg) { std::cerr << "Error [" << curr_time() << "] " << msg << std::endl; }

void err_msg(const std::string msg);

void assert_msg(bool, const std::string msg);

size_t num_columns(const char* file);
size_t num_rows(const char* file);

double trigamma(const double x);

////////////////////////////////////////////////////////////////
// just for debugging
template<typename T>
void dump_vec(const std::vector<T>& vec)
{
  for (int k = 0; k < vec.size(); ++k)
    std::cerr << "\t" << vec[k];
  std::cerr << std::endl;
}

#endif
